<?php

include('includes/basic.php');

$task=$_REQUEST['t'];
$q=$_REQUEST['tm'];
$creator=$_SESSION['uid'];
if($q=='s')
{
$time="insert into task_timeline(`task_id`,`start_time`,`created_by`) values ('$task',sysdate(),'$creator')";
$time_res1=mysql_query($time);
$timelineid=mysql_query("select * from task_timeline where start_time=sysdate() and created_by=$creator");
$timelineidr=mysql_fetch_array($timelineid);
$tid=$timelineidr['task_timeline_id'];
}
if($q=='e')
{
	$notes=$_POST['notes'];
	$time1=mysql_query("update task_timeline set end_time=sysdate(),notes='$notes',diff=((period_diff(sysdate(), start_time))/3600) where task_id='$task' and created_by='$creator'");
}
if($time_res1)
{
header("location:todo.php");
}
elseif($time1)
{
header("location:todo.php");
}
ob_flush();
?>
